// common/tabbar.js
let App = getApp();
Component({
  options: {
    addGlobalClass: true,
  },
  /**
   * 组件的属性列表
   */
  properties: {
    active: {
      type: String,
      value: "home"
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    isIphoneX: App.globalData.isIphoneX
  },
  lifetimes: {
    attached: function () {

    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    onChange(e) {
      // console.log(66, this.properties.active);
      let _text = e.currentTarget.dataset.text,
      _current = this.properties.active;
      if (_text !== _current) {
        if (_text == 'index') {
          wx.redirectTo({
            url: "/pages/index/index"
          })
        } else if (_text == 'actual') {
          wx.redirectTo({
            url: "/pages/actual/index"
          })
        } else if (_text == 'publish') {
          wx.redirectTo({
            url: "/pages/publish/index/index"
          })
        } else if (_text == 'goods') {
          wx.redirectTo({
            url: "/pages/publish/goods/index"
          })
        }
      }
    }
  },
})